package com.gxc.datacore.ws.util;

import javax.xml.ws.Endpoint;

import com.gxc.authcore.system.util.ParamUtil;
import com.gxc.datacore.ws.wsservice.QueryService;

public class WebServiceUtil {

	private static Endpoint dataQueryEndpoint;

	/**
	 * 开启数据查询服务借口
	 */
	public static void startDataQueryWS() {
		if (dataQueryEndpoint != null) {
			if (!dataQueryEndpoint.isPublished()) {
				dataQueryEndpoint.publish(ParamUtil.get("ws_queryService"));
			}
		} else {
			dataQueryEndpoint = Endpoint.publish(
					ParamUtil.get("ws_queryService"), new QueryService());
		}
	}

	/**
	 * 关闭数据查询服务借口
	 */
	public static void stopDataQueryWS() {
		if (dataQueryEndpoint != null && dataQueryEndpoint.isPublished()) {
			dataQueryEndpoint.stop();
		}
	}

}
